home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / BARNET / FREENET / MELL / NETLIB00 / !NetLib / netinet / h / ip_var < prev    next >
Text File  |  1996-04-18  |  4KB  |  113 lines

  1. #ifndef __netinet_ip_var_h
  2. #define __netinet_ip_var_h
  3.  
  4. /* Freenet programmers interface - netinet/ip_var.h - 23/5/95 */
  5.  
  6. /*
  7.  * Overlay for ip header used by other protocols (tcp, udp).
  8.  */
  9. struct ipovly {
  10.     caddr_t    ih_next, ih_prev;    /* for protocol sequence q's */
  11.     u_char    ih_x1;            /* (unused) */
  12.     u_char    ih_pr;            /* protocol */
  13.     short    ih_len;            /* protocol length */
  14.     struct    in_addr ih_src;        /* source internet address */
  15.     struct    in_addr ih_dst;        /* destination internet address */
  16. };
  17.  
  18. /*
  19.  * Ip reassembly queue structure.  Each fragment
  20.  * being reassembled is attached to one of these structures.
  21.  * They are timed out after ipq_ttl drops to 0, and may also
  22.  * be reclaimed if memory becomes tight.
  23.  */
  24. struct ipq {
  25.     struct    ipq *next,*prev;    /* to other reass headers */
  26.     u_char    ipq_ttl;        /* time for reass q to live */
  27.     u_char    ipq_p;            /* protocol of this fragment */
  28.     u_short    ipq_id;            /* sequence id for reassembly */
  29.     struct    ipasfrag *ipq_next,*ipq_prev;
  30.                     /* to ip headers of fragments */
  31.     struct    in_addr ipq_src,ipq_dst;
  32. };
  33.  
  34. /*
  35.  * Ip header, when holding a fragment.
  36.  *
  37.  * Note: ipf_next must be at same offset as ipq_next above
  38.  */
  39. struct    ipasfrag {
  40.     u_int    ip_hl   : 4,
  41.         ip_v    : 4;
  42.     u_int    ipf_mff : 8;        /* XXX overlays ip_tos: use low bit
  43.                      * to avoid destroying tos;
  44.                      * copied from (ip_off&IP_MF) */
  45.     u_int    ip_len  : 16;
  46.     u_short    ip_id;
  47.     short    ip_off;
  48.     u_char    ip_ttl;
  49.     u_char    ip_p;
  50.     u_short    ip_sum;
  51.     struct    ipasfrag *ipf_next;    /* next fragment */
  52.     struct    ipasfrag *ipf_prev;    /* previous fragment */
  53. };
  54.  
  55. /*
  56.  * Structure stored in mbuf in inpcb.ip_options
  57.  * and passed to ip_output when ip options are in use.
  58.  * The actual length of the options (including ipopt_dst)
  59.  * is in m_len.
  60.  */
  61. #define MAX_IPOPTLEN    40
  62.  
  63. struct ipoption {
  64.     struct    in_addr ipopt_dst;    /* first-hop dst if source routed */
  65.     char    ipopt_list[MAX_IPOPTLEN];    /* options proper */
  66. };
  67.  
  68. /*
  69.  * Structure attached to inpcb.ip_moptions and
  70.  * passed to ip_output when IP multicast options are in use.
  71.  */
  72. struct ip_moptions {
  73.     struct    ifnet *imo_multicast_ifp; /* ifp for outgoing multicasts */
  74.     u_char    imo_multicast_ttl;    /* TTL for outgoing multicasts */
  75.     u_char    imo_multicast_loop;    /* 1 => hear sends if a member */
  76.     u_short    imo_num_memberships;    /* no. memberships this socket */
  77.     struct    in_multi *imo_membership[IP_MAX_MEMBERSHIPS];
  78. };
  79.  
  80. struct    ipstat {
  81.     u_long    ips_total;        /* total packets received */
  82.     u_long    ips_badsum;        /* checksum bad */
  83.     u_long    ips_tooshort;        /* packet too short */
  84.     u_long    ips_toosmall;        /* not enough data */
  85.     u_long    ips_badhlen;        /* ip header length < data size */
  86.     u_long    ips_badlen;        /* ip length < ip header length */
  87.     u_long    ips_fragments;        /* fragments received */
  88.     u_long    ips_fragdropped;    /* frags dropped (dups, out of space) */
  89.     u_long    ips_fragtimeout;    /* fragments timed out */
  90.     u_long    ips_forward;        /* packets forwarded */
  91.     u_long    ips_cantforward;    /* packets rcvd for unreachable dest */
  92.     u_long    ips_redirectsent;    /* packets forwarded on same net */
  93.     u_long    ips_noproto;        /* unknown or unsupported protocol */
  94.     u_long    ips_delivered;        /* datagrams delivered to upper level*/
  95.     u_long    ips_localout;        /* total ip packets generated here */
  96.     u_long    ips_odropped;        /* lost packets due to nobufs, etc. */
  97.     u_long    ips_reassembled;    /* total packets reassembled ok */
  98.     u_long    ips_fragmented;        /* datagrams sucessfully fragmented */
  99.     u_long    ips_ofragments;        /* output fragments created */
  100.     u_long    ips_cantfrag;        /* don't fragment flag was set, etc. */
  101.     u_long    ips_badoptions;        /* error in option processing */
  102.     u_long    ips_noroute;        /* packets discarded due to no route */
  103.     u_long    ips_badvers;        /* ip version != 4 */
  104.     u_long    ips_rawout;        /* total raw ip packets generated */
  105. };
  106.  
  107. /*
  108.  * Maximum size of the IP options for a packet
  109.  */
  110. #define    MAX_IPOPTLEN 40
  111.  
  112. #endif
  113.